<template>
  <div>
    <h1>tree</h1>
    <!--  -->
    <el-tree
      :data="data"
      :props="defaultProps"
      @node-click="handleNodeClick">
    </el-tree>
  </div>
</template>

<script>
  export default {
    data() {
      return {
        data: [
          {
            text: '一级 1',
            list: [
              {
                text: '二级 1-1',
                list: [
                  { text: '三级 1-1-1'}
                ]
              }
            ]
          }
        ],
        defaultProps: {
          children: 'list',
          label: 'text'
        }
      };
    },
    methods: {
      handleNodeClick(data) {
        console.log(data);
      }
    }
  };
</script>